#ifndef SCENE3D_H
#define SCENE3D_H

#include <QGLWidget>
#include "psglmodel.h"


class PSGLScene : public QGLWidget
{
   Q_OBJECT

   private:
      GLfloat xRot;
      GLfloat yRot;
      GLfloat zRot;
      GLfloat xTra;
      GLfloat yTra;
      GLfloat zTra;
      GLfloat nSca;

      GLfloat ratio;

      GLint frameNumber;
      GLint trackNumber;

      //QTimer *timer;
      QPoint ptrMousePosition;

      bool m_drawPlanet, m_drawTrajectory, m_drawText;

      void drawAxes();

      void selectFigures(QPoint mp);

   protected:
      void initializeGL();
      void resizeGL(int nWidth, int nHeight);
      void paintGL();
      void mousePressEvent(QMouseEvent* pe);
      void mouseMoveEvent(QMouseEvent* pe);
      void mouseReleaseEvent(QMouseEvent* pe);
      void wheelEvent(QWheelEvent* pe);
      void keyPressEvent(QKeyEvent* pe);

   //private slots:
      //void stopTmr();
      //void startTmr();

   public:

     PSGLModel glModel;

      void scale_plus();
      void scale_minus();
      void rotate_up();
      void rotate_down();
      void rotate_left();
      void rotate_right();
      void translate_down();
      void translate_up();
      void translate_left();
      void translate_right();
      void defaultScene();
      void trackObject(int trackID);

      PSGLScene(QWidget* parent = 0);
      ~PSGLScene();

  public slots:
    void changeFrame(int n);
    void drawPlanet(int drawFlag);
    void drawTrajectory(int drawFlag);
    void drawCaption(int drawFlag);
    void changeTracking(int n);
};
#endif
